/*
 *  AShader.h
 *  Amano Engine
 *
 *  Created by Aurelien Serandour on 07/03/11.
 *  Copyright 2011 __MyCompanyName__. All rights reserved.
 *
 */

#ifndef _AMANO_SHADER_H_
#define _AMANO_SHADER_H_

#include <map>
#include <string>
#include "OpenGL/gl.h"

namespace Amano
{
	typedef std::map<std::string, GLint> AShaderLocationLibrary;
	
	class AShader
	{
	public:
		AShader( const char* filenameVS, const char* filenamePS );
		~AShader();

	public:
		inline void useShader()
		{
			glUseProgram(m_shaderProgram);
		}
		
		inline void stopUsingShader()
		{
			glUseProgram(0);
		}
		
		void addLocation( const char* name );
		GLint getLocation( const char* name );
		
	private:
		GLint readAndCompileShader( const char* filename, GLenum type );
		
	private:
		GLuint m_shaderProgram;
		AShaderLocationLibrary m_locations;
	};
}

#endif // _AMANO_SHADER_H_